<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://localhost" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://localhost" elementFormDefault="qualified">
  <xs:element name="report">
    <xs:annotation>
      <xs:documentation xml:lang="ro">Raport periodic, ce se transmite către casa de asigurări, cu toate serviciile efectuate de furnizorul de servicii paraclinice. </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="services" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation xml:lang="ro">Lista serviciilor paraclinice raportate către casa de asigurări.</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="service" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation xml:lang="ro">Serviciu raprotat</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="foreignPerson" type="foreignPersonType" minOccurs="0">
                      <xs:annotation>
                        <xs:documentation xml:lang="ro">Dacă pacientul care efectuiază serviciu este de altă naţionalitate decât cea română atunci se transmit toate datele acestuia pentru fiecare serviciu efectuat.</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="AppID" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Identificatorul unic al serviciului paraclinic efectuat</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="stencilNo" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Numărul parafei medicului care a efectual serviciu respectiv.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="personPID" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Codul numeric personal al pacientului beneficiar de serviciu paraclinic respectiv</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="13" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="patientInsuranceHouse" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Casa de asigurări de sănătate la care este asigurat pacientul. </xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="reportedService" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Codul serviciului paraclinic raportat.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="medSrvPack" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Pachetul de asigurări medicale pentru care a optat pacientul.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="quantity" type="xs:unsignedInt" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Numărul serviciilor paraclinice efectuate.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="merNo" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Numărul de înregistrare în registru medical</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="serviceDate" type="xs:date" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Data la care a fost efectuat serviciu paraclinic.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="diagnostic" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Diagnosticul bolii pentru care sa făcut serviciu paraclinic.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="reportedTarrif" type="xs:double" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Tariful raportat pentru serviciu efectuat.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="refferedByStencilNo" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Parafa medicală a medicului care a emis biletul de trimitere pentru efectuarea serviciului paraclinic.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="refferedBySerialNo" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Numărul biletului de trimitere în baza căruia sa efectuat serviciu paraclinic.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="refferedBySerialCode" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Seria biletului de trimitere</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="refferedBySpecialty" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Specializarea medicului care a emis biletul.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="refferedByDiagnostic" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Diagnosticul prezumtiv dat de medicul care a emis biletul de trimitere.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="refferedByContractNo" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Numărul de contract din bietul de trimitere.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="refferedByDate" type="xs:date" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Data la care a fost emis biletul de trimitere.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="cockroftGaultFormula" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Daca serviciu paraclinic este unul dintre acelea pentru care se completează formula Cockroft-Gault atunci în acest câmp trebuie să se specifice aceasă formulă de calcul.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="100" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="patientSource" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Sursa pacientului, din ambulator sau internat. (Poate fi lasat necompletat sau se completeaza valoarea implicita A)</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:enumeration value="A">
                          <xs:annotation>
                            <xs:documentation xml:lang="ro">Ambulator</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                        <xs:enumeration value="I">
                          <xs:annotation>
                            <xs:documentation xml:lang="ro">Internat</xs:documentation>
                          </xs:annotation>
                        </xs:enumeration>
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="nhpCode" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Codul PNS-ului în baza căruia a fost efectuat serviciul (valoarea codului din nomenclatorul de PNS-uri).</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="onDemand" type="xs:boolean" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Serviciu medical efectuat la cerere.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="emergency" type="xs:boolean" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Serviciu clinic efectuat în regim de urgenţă.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="lastOption" type="xs:boolean" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Indică dacă investigaţia efectuată este ultima opţiune în identificarea diagnosticului.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="refferedByPC" type="xs:boolean" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Indică dacă investigaţia paraclinică efectuată de pacient este la recomandarea medicului de familie.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="personType" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Tipul de persoană asigurată</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="AppKey" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Cheia de identificare a aplicaţiei de raportare (producator de software 3rd partry)</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="AppID" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Identificatorul unic al raportării</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="laboratories" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Numele furnizorului de servicii paraclinice</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="100" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="fiscalCode" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Codul fiscal al furnizorului de servicii paraclinice</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="contractNo" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Numărul de contract încheiat între furnizorul de servicii paraclinice şi casa de asigurări.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="40" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="insuranceHouse" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Codul casei de asigurări către care se face raportarea.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="reportingDate" type="xs:date" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Data la care s-a emis fişierul de raportare.</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="startFrom" type="xs:date" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Data de început a perioadei de raportare.</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="endTo" type="xs:date" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Data de sfârşit a perioadei de raportare.</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="invoiceNo" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="en">Invoice number</xs:documentation>
          <xs:documentation xml:lang="ro">Numar factura</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="invoiceDate" type="xs:date" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="en">Invoice date</xs:documentation>
          <xs:documentation xml:lang="ro">Data factura</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="invoiceValue" type="xs:decimal" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="en">Invoice amount</xs:documentation>
          <xs:documentation xml:lang="ro">Valoare factura</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="isCorrection" type="xs:unsignedInt" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Flag care precizează dacă raportarea este de corecţie</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="totalAnalysisValue" type="xs:double" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Valoarea totala a serviciilor de tip analiza</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="totalRadiologyValue" type="xs:double" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Valoarea totala a serviciilor de tip radiologie</xs:documentation>
        </xs:annotation>
      </xs:attribute>
			<xs:attribute name="totalExplorationValue" type="xs:double" use="required">
				<xs:annotation>
					<xs:documentation xml:lang="ro">Valoarea totala a serviciilor de tip explorari functionale</xs:documentation>
				</xs:annotation>
			</xs:attribute>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="foreignPersonType">
    <xs:annotation>
      <xs:documentation xml:lang="ro">Tipul de date folosit pentru persoane străine</xs:documentation>
    </xs:annotation>
    <xs:attribute name="personIdentifier" use="required">
      <xs:annotation>
        <xs:documentation xml:lang="ro">Codul de identificare a persoanei străine.</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:maxLength value="20" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="personFirstName" use="optional">
      <xs:annotation>
        <xs:documentation xml:lang="ro">Numele persoanei străine.</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:maxLength value="40" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="personLastName" use="optional">
      <xs:annotation>
        <xs:documentation xml:lang="ro">Prenumele persoanei străine.</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:maxLength value="40" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="birthDate" type="xs:date" use="optional">
      <xs:annotation>
        <xs:documentation xml:lang="ro">Data la care s-a născut persoana de cetăţenie străină.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="countryCode" use="optional">
      <xs:annotation>
        <xs:documentation xml:lang="ro">Codul ţării de origine a persoanei de cetăţenie străină.</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:maxLength value="20" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="cardCode" use="optional">
      <xs:annotation>
        <xs:documentation xml:lang="ro">Codul cardului de asigurări dacă persoana străină beneficiază de un card de asigurări</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:maxLength value="40" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="cardExpireDate" type="xs:date" use="optional">
      <xs:annotation>
        <xs:documentation xml:lang="ro">Data la care expiră cardul de asigurări.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="emissiveOrgUnitCode" use="optional">
      <xs:annotation>
        <xs:documentation xml:lang="ro">Codul casei de asigurări care a emis cadrul.</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:maxLength value="30" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>
</xs:schema>